from openai import OpenAI

openai_api_key = "EMPTY"
openai_api_base = "http://localhost:8000/v1"

client = OpenAI(
    api_key=openai_api_key,
    base_url=openai_api_base,
)

messages = [
    {"role": "user", "content": "问题：某分裂组织在边境地区策划武装割据，并与境外势力秘密勾结，其首要分子甲在实施过程中被抓获。请问甲的行为构成何罪？应当如何量刑？"}
]

response = client.chat.completions.create(
    model="/mnt/codes/qwen3/fine-tuning/Qwen3-8B-finetuned-fp16",
    messages=messages,
    stream=True,
)

for chunk in response:
    if hasattr(chunk.choices[0].delta, "content") and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
print()  # 输出换行